Navigating using keyboard hotkeys
Several new hotkeys needed:
Go to search field
Go to the root of the project
Create new page
Delete page
There should be a way to follow a link by keyboard (Ctrl-Enter?)
Maybe there should be a special API to allow user-definable keyb. hotkeys?
2020/5/29 02:02
Just created a script to:
exit Edit mode by pressing Esc
move focus to the Search field by pressing Cmd+k
create new page by pressing Cmd+Shift+k
code: script.js
// press Cmd+\ to go to the Project root
// press Cmd+K to go to the Search (Bonus: press Enter in an empty Search field to go to the Project root)
// press Cmd+Shift+K to create new page
addEventListener('keydown', e => {
// Esc
if (e.key === 'Escape') {
$('.project-home').focus()
return
}
if (e.key === ('k' || 'ะป')) {
// Cmd+Shift+k
if (e.shiftKey && e.metaKey) {
$('.new-button')0.click() return
}
// Cmd+Key
if (e.metaKey) {
$('input.form-control').focus()
return
}
// plain k
return
}
if ((e.key === ('\\' || 's')) && e.metaKey) {
// Cmd+\
console.log('\\')
$('.project-home')0.click() return
}
return
});
TODO
Unfortunately, I'm still unable to script any of the Page menu items (Duplicate, Delete, Pin page etc). If you know, how to do this - just show me! /icons/doing.icon